Advertisement
Guest User

Untitled

a guest
Dec 21st, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <avr/io.h>
  2. #include <util/delay.h>
  3.  
  4. #define BLINK_DELAY_MS 1000
  5.  
  6.  
  7. int main(void)
  8. {
  9.     /* set pins 0-3 of PORTB for output*/
  10. //  DDRB = 0xFF;
  11. //  DDRB |= _BV(DDB0);
  12. //  DDRB |= _BV(DDB1);
  13. //  DDRB |= _BV(DDB2);
  14. //  DDRB |= _BV(DDB3);
  15.     //PORTB = 0x00;
  16.  
  17.     PORTB = 0x02;
  18.     _delay_ms(1000);
  19.     while(1) {
  20.  
  21.         PORTB = 0x05;
  22.         _delay_ms(1000);
  23.         PORTB = 0x02;
  24.         _delay_ms(1000);
  25.     };
  26.     return 0;
  27. }
  28.  
  29. int main2(void)
  30. {
  31.     /* set pins 0-3 of PORTB for output*/
  32.     DDRB = 0xFF;
  33.     DDRB |= _BV(DDB0);
  34.     DDRB |= _BV(DDB1);
  35.     DDRB |= _BV(DDB2);
  36.     DDRB |= _BV(DDB3);
  37.     //PORTB = 0x00;
  38.  
  39.     PORTB = 0x05;
  40.     _delay_ms(1000);
  41.     //main2();
  42.     while(1) {};
  43.  
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement